package com.cyy.controller;

import com.cyy.common.CommonException;
import com.cyy.service.RpcService;
import com.cyy.service.RpcServiceHandler;
import org.springframework.beans.factory.annotation.Autowired;

public class BaseController {

    @Autowired
    private RpcServiceHandler rpcServiceHandler;

    protected RpcService getRpcServiceByName(String coin){
        RpcService service = rpcServiceHandler.getByName(coin);
        if(service == null){
            throw new CommonException("COIN["+coin+"]不支持");
        }
        return service;
    }
}
